package com.xc.shopping_font.Controller;



import com.xc.shopping_font.common.Result;
import com.xc.shopping_font.entity.Banner;
import com.xc.shopping_font.mapper.BannerMapper;
import com.xc.shopping_font.service.BannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/banner")
public class BannerController {

    @Autowired
    BannerService bannerService;

    @Resource
    BannerMapper bannerMapper;


    @GetMapping
    public Result getPics(){

       Banner banner =  bannerMapper.selectpicById((long) 1);

       banner.setId(null);



       return Result.success(banner);
    }


    @PostMapping
    public Boolean saveBanner(@RequestBody Banner banner){
      return (bannerService.saveOrUpdate(banner));
    }


}
